package com.learnyou.server.xingzuo.biz.handle;

import feign.Logger;
import feign.codec.Decoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringDecoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FeignConfig {

    @Bean
    public Decoder feignDecoder() {
        WechatResponseConvertor wechatResponseConvertor = new WechatResponseConvertor();
        ObjectFactory objectFactory = () -> new HttpMessageConverters(wechatResponseConvertor);
        return new SpringDecoder(objectFactory);
    }

    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }
}